    package javaRevise.io;

    import java.io.*;

    /**
     * @author WuYongheng
     * @date 2021/12/4
     * @description 演示字符流的使用
     */
    public class InputStreamTest2 {
        public static void main(String[] args) throws IOException {
            File f = new File("D://bb.txt");
            Writer out = new FileWriter(f);
            String str = "Hello 这是字符流";
            out.write(str);
            out.close();
            // 写完之后进行读操作
            Reader in = new FileReader(f);
            char[] c = new char[20];
            int len = in.read(c);
            in.close();
            System.out.println("读取文件内容输入到控制台：");
            System.out.println(new String(c, 0, len));
        }
    }
